package com.xzp.exception;

import com.xzp.enums.ResultEnum;

/**
 * SpringBoot对RuntimeException才能支持事物回滚
 */
public class GirlException extends RuntimeException{

    private Integer code;

//    public GirlException(Integer code,String message) {
//        super(message);
//        this.code = code;
//    }


    //接受的参数为错误类型的枚举类
    public GirlException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
